<?php

namespace App\Http\Controllers\Reception;
use App\Tables\admin_users;
use Illuminate\Http\Request;
use\App\Http\Middleware\CrossHttp;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
// use App\Http\Controllers\Reception\JWTAuth;
class Login extends Controller
{
	public function login(Request $request){
		if($request->isMethod('options')){
			return "200ok";
		}
		$admin_name=$request->username;
		$newpassword=$request->password;
		$res=admin_users::where("admin_name",$admin_name)->first();
		if($res){
			$oldpassword=$res->admin_password;
			if(!Hash::check($newpassword,$oldpassword)){
				return ['code'=>1];
			} 
		return $res;	
		}
	}      
  }
